POV-Ray : Newsgroups : povray.binaries.images : Copying pigments with crackle (124k jpg) : Copying pigments with crackle (124k jpg) Server Time
1 Aug 2024 12:27:26 EDT (-0400)
  Copying pigments with crackle (124k jpg)  
From: stbenge
Date: 28 Jul 2008 19:15:12
Message: <488e5300@news.povray.org>
Hi everyone,

Years ago, somebody posted a swirly pigment. It resembled the swirls you 
see in clouds sometimes. I have tried looking for the code many times, 
but to no avail. The code has been lost.

Every once in a while I try to recreate that code using pigment 
functions. Every time I've tried, I've failed. Until today.

I based my work on the premise that the target pattern must be 
translated according to another pattern, in this case crackle form x. 
What I have arrived at must be different from the aforementioned 
poster's code, since his tended to have small gray boxes right at the 
center of each crackle cell. There is no such artifact in my code, and I 
can't be sure just how close my effect comes to his.

Here is some code:

#macro pcc(pgmt, Mod)
  #local pgmt2=function{pigment{pgmt}}
  #local pg1=
  function{
   pigment{
    crackle form x
    scale .25
   }
  }
  pigment_pattern{
   function{
    pgmt2(
     (pow(pg1(x+Mod,y,z).grey,2)-pow(pg1(x-Mod,y,z).grey,2))/(Mod*64),
     (pow(pg1(x,y+Mod,z).grey,2)-pow(pg1(x,y-Mod,z).grey,2))/(Mod*64),
     z
    ).grey
   }
  }
#end

#declare my_pigment=
pigment{
  pcc(
   pigment{
    spiral1 1
    sine_wave frequency 1
    scale .125
   }
   ,.085
  )
}

The macro takes two arguments. The first is the pigment you wish to have 
copied into each crackle cell. The second indicates how sharp you want 
the edges to be. Smaller values = sharper edges. The macro returns a 
pigment_pattern, so it can be used in any pattern block (pigment, 
normal, texture, etc.)

I hope some of you find a use for this. I had hoped to use it for making 
height fields. I'll post any interesting results I might get.

Sam


Post a reply to this message


Attachments:
Download 'pcc1.jpg' (123 KB)

Preview of image 'pcc1.jpg'
pcc1.jpg


 

Copyright 2003-2023 Persistence of Vision Raytracer Pty. Ltd.